Bug 17378 - Add ability to specify maximum number of items per record
Summary: Add ability to specify maximum number of items per record
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-29 15:47 UTC by Kyle M Hall
Modified: 2018-10-26 20:53 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:


Attachments
Bug 17378: Add ability to specify maximum number of items per record (12.41 KB, patch)
2018-05-03 17:26 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 17378: Add ability to specify maximum number of items per record (12.45 KB, patch)
2018-10-26 10:49 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2016-09-29 15:47:25 UTC
Some libraries want to be able to specify a hard limit on the number of items a record can have. It would be nice to have this set per record type, but since most libraries use item level itemtypes, that would make it confusing and non-intuitive. The simplest and most straight forward approach would just be to have a system preference. Koha should then just report that it failed to create an item if the librarian has hit the upper limit specified in the system preference.
Comment 1 Katrin Fischer 2016-10-16 12:31:24 UTC
Bit puzzled about this one - do you know what the use case is?
Comment 2 Kyle M Hall 2017-08-10 15:25:19 UTC
(In reply to Katrin Fischer from comment #1)
> Bit puzzled about this one - do you know what the use case is?

Because Zebra is size-bound, this will help libraries control the number of items on a record. In general there is a threshold where more items will make the record no longer show in zebra search results because it is too large.
Comment 3 Katrin Fischer 2017-08-15 15:47:28 UTC
Hm, as the problem also depends on the record size, maybe we could check this dynamically? Every number of items set to a max seems like mostly guessing/luck.
Comment 4 Kyle M Hall 2018-05-03 14:18:50 UTC
(In reply to Katrin Fischer from comment #3)
> Hm, as the problem also depends on the record size, maybe we could check
> this dynamically? Every number of items set to a max seems like mostly
> guessing/luck.

Indeed it is an educated guess, but with much lower overhead. I think checking record sizes would overly-complicate the libraries request. They have a good understanding of the size of their items and how many they can put on a record before it will  no longer be indexed by zebra.
Comment 5 Kyle M Hall 2018-05-03 17:26:56 UTC
Created attachment 75018 [details] [review]
Bug 17378: Add ability to specify maximum number of items per record

Some libraries want to be able to specify a hard limit on the number of items a record can have. It would be nice to have this set per record type, but since most libraries use item level itemtypes, that would make it confusing and non-intuitive. The simplest and most straight forward approach would just be to have a system preference. Koha should then just report that it failed to create an item if the librarian has hit the upper limit specified in the system preference.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Set the new syspref RecordItemLimit to 3
4) Find a record with 4 or more records
5) Note in the catalog toolbar you cannot choose the add new item option
6) Note in the items editor you can edit items but not add new ones
Comment 6 Cab Vinton 2018-08-30 03:06:31 UTC
The sandbox you've requested is not ready.
Some problems occurred applying patches from bug 17378:
<h1>Something went wrong !</h1>Applying: Bug 17378: Add ability to specify maximum number of items per record
.git/rebase-apply/patch:159: trailing whitespace.

warning: 1 line adds whitespace errors.
.git/rebase-apply/patch:159: trailing whitespace.

w
arning: 
1
 line adds whitespace errors.

e
rror: 
F
ailed to merge in the changes.

Using index info to reconstruct a base tree...
M       installer/data/mysql/sysprefs.sql
M       koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
M       koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
M       koha-tmpl/intranet-tmpl/prog/js/catalog.js
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/js/catalog.js
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
Auto-merging installer/data/mysql/sysprefs.sql
Patch failed at 0001 Bug 17378: Add ability to specify maximum number of items per record
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run git bz apply --continue.
If you would prefer to skip this patch, instead run git bz apply --skip.
To restore the original branch and stop patching run git bz apply --abort.
Bug 17378 - Add ability to specify maximum number of items per record

75018 - Bug 17378: Add ability to specify maximum number of items per record

Apply? [(y)es, (n)o, (i)nteractive] Patch left in /tmp/Bug-17378-Add-ability-to-specify-maximum-number-of-9CbVVm.patch .
Comment 7 Kyle M Hall 2018-10-26 10:49:40 UTC
Created attachment 81279 [details] [review]
Bug 17378: Add ability to specify maximum number of items per record

Some libraries want to be able to specify a hard limit on the number of items a record can have. It would be nice to have this set per record type, but since most libraries use item level itemtypes, that would make it confusing and non-intuitive. The simplest and most straight forward approach would just be to have a system preference. Koha should then just report that it failed to create an item if the librarian has hit the upper limit specified in the system preference.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Set the new syspref RecordItemLimit to 3
4) Find a record with 4 or more records
5) Note in the catalog toolbar you cannot choose the add new item option
6) Note in the items editor you can edit items but not add new ones
Comment 8 Cori Lynn Arnold 2018-10-26 13:11:12 UTC
It seems a little strange that if the threshold is 3 that 4 items can be attached...

I started with a record that had two items, attached a third and expected to get the message at that point that I couldn't add a fourth, but I proceeded to add a fourth and then got the message I couldn't add a fifth. I think if the threshold is 3 that only 3 items should be able to be attached.

--cori lynn
Comment 9 Cori Lynn Arnold 2018-10-26 13:22:07 UTC
It also won't allow you to add 4 items as duplicates, so the functionality is inconsistent.