Bug 34109 - When adding items on receive, mandatory fields are not checked
Summary: When adding items on receive, mandatory fields are not checked
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: 22.11
Hardware: All All
: P5 - low major (vote)
Assignee: Nick Clemens
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 8179 34022
Blocks:
  Show dependency treegraph
 
Reported: 2023-06-23 07:51 UTC by Katrin Fischer
Modified: 2023-09-15 09:35 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04


Attachments
Bug 34109: Check mandatory item fields when creating during recipt (4.11 KB, patch)
2023-08-04 14:18 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 34109: Check mandatory item fields when creating during recipt (4.15 KB, patch)
2023-08-04 15:10 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 34109: Check mandatory item fields when creating during recipt (4.22 KB, patch)
2023-08-17 10:09 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2023-06-23 07:51:16 UTC
The itemtype is mandatory in the ACQ and all other item forms. But when adding items in acq on receive, there is no error whatsoever if you add items without itemtypes.

To make things worse: When you don't notice the mistake, Koha will just add the item with itemtype "Books" (possibly as it's the first non empty entry in the pull down).

Same if you set any other field to mandatory, it shows as red in the form, but it's not enforced. For text fields the field will then remain empty (tested with callnumber)

To test:
* Go to administration > frameworks > ACQ > MARC structure > 952
* Set callnumber (o) or barcode (p) to mandatory
* In acquisition: 
* Create a basket with "create items on order" and "is standing"
  "standing" helps as you can do multiple receives testing different things, 
  but is optional
* Add an order line
* Receive shipment
* Verify the mandatory fields show in the item form
* Save
* Verify no message/warning appears
* Verify the item was added with itemtype Books (on sample data) and empty mandatory field
Comment 1 Nick Clemens 2023-08-04 14:18:20 UTC
Created attachment 154280 [details] [review]
Bug 34109: Check mandatory item fields when creating during recipt

This patch adds a check of mandatory item fields before saving during order receipt.
We check both when adding the item initially, and when submitting the order, as it will use
the values from the open form.

To test:
* Go to administration > frameworks > ACQ > MARC structure > 952
* Set callnumber (o) or barcode (p) to mandatory
* In acquisition:
* Create a basket with "create items on order" and "is standing"
  "standing" helps as you can do multiple receives testing different things,
  but is optional
* Add an order line
* Receive shipment
* Verify the mandatory fields show in the item form
* Set itemtype = Music
* Save with the fields blank
* Item row is added, no warning
* Edit the item, change the item type to blank
* Click 'Confirm' for the order without closing the item edit form
* Verify the item was added with itemtype Books (on sample data) and empty mandatory field
* Apply patch
* Repeat above, however, you should not be able to submit the item or order until mandatory fields are filled
Comment 2 Sam Lau 2023-08-04 15:10:14 UTC
Created attachment 154286 [details] [review]
Bug 34109: Check mandatory item fields when creating during recipt

This patch adds a check of mandatory item fields before saving during order receipt.
We check both when adding the item initially, and when submitting the order, as it will use
the values from the open form.

To test:
* Go to administration > frameworks > ACQ > MARC structure > 952
* Set callnumber (o) or barcode (p) to mandatory
* In acquisition:
* Create a basket with "create items on order" and "is standing"
  "standing" helps as you can do multiple receives testing different things,
  but is optional
* Add an order line
* Receive shipment
* Verify the mandatory fields show in the item form
* Set itemtype = Music
* Save with the fields blank
* Item row is added, no warning
* Edit the item, change the item type to blank
* Click 'Confirm' for the order without closing the item edit form
* Verify the item was added with itemtype Books (on sample data) and empty mandatory field
* Apply patch
* Repeat above, however, you should not be able to submit the item or order until mandatory fields are filled

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 3 Martin Renvoize 2023-08-17 10:09:11 UTC
Created attachment 154512 [details] [review]
Bug 34109: Check mandatory item fields when creating during recipt

This patch adds a check of mandatory item fields before saving during order receipt.
We check both when adding the item initially, and when submitting the order, as it will use
the values from the open form.

To test:
* Go to administration > frameworks > ACQ > MARC structure > 952
* Set callnumber (o) or barcode (p) to mandatory
* In acquisition:
* Create a basket with "create items on order" and "is standing"
  "standing" helps as you can do multiple receives testing different things,
  but is optional
* Add an order line
* Receive shipment
* Verify the mandatory fields show in the item form
* Set itemtype = Music
* Save with the fields blank
* Item row is added, no warning
* Edit the item, change the item type to blank
* Click 'Confirm' for the order without closing the item edit form
* Verify the item was added with itemtype Books (on sample data) and empty mandatory field
* Apply patch
* Repeat above, however, you should not be able to submit the item or order until mandatory fields are filled

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2023-08-17 10:09:45 UTC
Nice work, QA scripts all happy and no regressions spotted.

Passing QA
Comment 5 Tomás Cohen Arazi 2023-09-06 12:58:00 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Fridolin Somers 2023-09-08 19:11:56 UTC
Pushed to 23.05.x for 23.05.04
Comment 7 Matt Blenkinsop 2023-09-15 09:35:11 UTC
Missing dependencies for 22.11.x - not backporting

Nice work everyone!