If the system preference AcqCreateItem is "Create an item when ordering", we would like to set a value for items. For example you could define status for the field items.notforloan (995$o for UNIMARC) with 4 = On order, 5: On treatment. Then, it would be great to fill the item field 995$o with "5".
Created attachment 10472 [details] [review] Bug 8307: Set a value for items when ordering If items are created when ordering, this patch allows to add a value for a field. Test plan: Define status for items.notforloan (mapping 995$o in unimarc), for example 4:On order, 5:On treatment Set the Syspref AcqCreateItem on "ordering". ACQ framework : set default value = 4 for 995$o (in unimarc) Syspref AcqItemStatusWhenReceived : set "995$o=5" When ordering the item, default status will be 4 ; when receiving the item, status will be changed from 4 to 5
SandBox Test result: <h1>Something went wrong !</h1>Applying: Bug 8307: Set a value for items when ordering<br/> Using index info to reconstruct a base tree...<br/> Falling back to patching base and 3-way merge...<br/> Auto-merging installer/data/mysql/sysprefs.sql<br/> CONFLICT (content): Merge conflict in installer/data/mysql/sysprefs.sql<br/> Auto-merging installer/data/mysql/updatedatabase.pl<br/> CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl<br/> Failed to merge in the changes.<br/> Patch failed at 0001 Bug 8307: Set a value for items when ordering<br/> When you have resolved this problem run git am --resolved.<br/> If you would prefer to skip this patch, instead run git am --skip.<br/> To restore the original branch and stop patching run git am --abort.<br/> Bug 8307 - Set a value for items when receiving<br/> <br/> Bug 8307: Set a value for items when ordering<br/> Apply? [yn] <br/> Patch left in /tmp/Bug-8307-Set-a-value-for-items-when-ordering-K_sCQB.patch<br/> <br/>=== translation installation ===<br/> If you use this system for the 1st time, you may find usefull to reach the wiki page http://wiki.koha-community.org/wiki/Sandboxes to have some information about those results, to check if everything went well & if you can test the patch properly
Created attachment 11379 [details] [review] Bug 8307: Set a value for items when ordering Rebased patch
Patch tested with a sandbox, by Delaye Stephane <stephane.delaye@biblibre.com>
Created attachment 11525 [details] [review] Bug 8307: Set a value for items when ordering If items are created when ordering, this patch allows to add a value for a field. Test plan: Define status for items.notforloan (mapping 995$o in unimarc), for example 4:On order, 5:On treatment Set the Syspref AcqCreateItem on "ordering". ACQ framework : set default value = 4 for 995$o (in unimarc) Syspref AcqItemStatusWhenReceived : set "995$o=5" When ordering the item, default status will be 4 ; when receiving the item, status will be changed from 4 to 5 Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com>
QA Comment: I am just having doubts over the form of the preference. Filling in something like 952x=9 and parsing that. Could you please send a mail to the dev list and acquire some community consensus about this unusual form? Thank you.
Created attachment 13463 [details] [review] Bug 8307: Set a value for subfields when receiving If items are created when ordering, this patch allows to add a value for some items subfields. Test plan: Define status for items.notforloan (mapping 995$o in unimarc), for example 4:On order, 5:On treatment Set the Syspref AcqCreateItem on "ordering". ACQ framework : set default value = 4 for 995$o (in unimarc) Syspref AcqItemSetSubfieldsWhenReceived : set "o=5|b='foo bar'" When ordering the item, default status will be 4 ; when receiving the item, status will be changed from 4 to 5. The subfield b have to contain 'foo bar'
This new patch change the format of the syspref (subfield_1=value_1|...|subfield_n=value_n) Like this, it is possible to set any items subfields (not specific to the status value).
Jonathan: Could you have a look at 9088 too. That report deals with default values for AcqCreateItem=cataloging or receiving. Thanks Marcel
Applying: Bug 8307: Set a value for subfields when receiving Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging installer/data/mysql/sysprefs.sql CONFLICT (content): Merge conflict in installer/data/mysql/sysprefs.sql Auto-merging installer/data/mysql/updatedatabase.pl CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl Failed to merge in the changes. Patch failed at 0001 Bug 8307: Set a value for subfields when receiving When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". Bug 8307 - Set a value for items when receiving
Sorry was a bit quick for copy the error message, i tried to test this patch on sandbox, it did not work correctly.
Created attachment 16235 [details] [review] Bug 8307: Set a value for subfields when receiving If items are created when ordering, this patch allows to add a value for some items subfields. Test plan: Define status for items.notforloan (mapping 995$o in unimarc), for example 4:On order, 5:On treatment Set the Syspref AcqCreateItem on "ordering". ACQ framework : set default value = 4 for 995$o (in unimarc) Syspref AcqItemSetSubfieldsWhenReceived : set "o=5|b='foo bar'" When ordering the item, default status will be 4 ; when receiving the item, status will be changed from 4 to 5. The subfield b have to contain 'foo bar'
Patch tested with a sandbox, by Frederic Durand <frederic.durand@unilim.fr>
Created attachment 16250 [details] [review] Bug 8307: Set a value for subfields when receiving If items are created when ordering, this patch allows to add a value for some items subfields. Test plan: Define status for items.notforloan (mapping 995$o in unimarc), for example 4:On order, 5:On treatment Set the Syspref AcqCreateItem on "ordering". ACQ framework : set default value = 4 for 995$o (in unimarc) Syspref AcqItemSetSubfieldsWhenReceived : set "o=5|b='foo bar'" When ordering the item, default status will be 4 ; when receiving the item, status will be changed from 4 to 5. The subfield b have to contain 'foo bar' Signed-off-by: Frederic Durand <frederic.durand@unilim.fr>
Created attachment 18605 [details] [review] Bug 8307: Set a value for subfields when receiving If items are created when ordering, this patch allows to add a value for some items subfields. Test plan: Define status for items.notforloan (mapping 995$o in unimarc), for example 4:On order, 5:On treatment Set the Syspref AcqCreateItem on "ordering". ACQ framework : set default value = 4 for 995$o (in unimarc) Syspref AcqItemSetSubfieldsWhenReceived : set "o=5|b='foo bar'" When ordering the item, default status will be 4 ; when receiving the item, status will be changed from 4 to 5. The subfield b have to contain 'foo bar' Signed-off-by: Frederic Durand <frederic.durand@unilim.fr>
Two simple merge conflicts resolved.
Created attachment 18606 [details] [review] Bug 8307: Set a value for subfields when receiving If items are created when ordering, this patch allows to add a value for some items subfields. Test plan: Define status for items.notforloan (mapping 995$o in unimarc), for example 4:On order, 5:On treatment Set the Syspref AcqCreateItem on "ordering". ACQ framework : set default value = 4 for 995$o (in unimarc) Syspref AcqItemSetSubfieldsWhenReceived : set "o=5|b='foo bar'" When ordering the item, default status will be 4 ; when receiving the item, status will be changed from 4 to 5. The subfield b have to contain 'foo bar' Signed-off-by: Frederic Durand <frederic.durand@unilim.fr>
Forgot: 3.11 -> 3.13
QA Comment: Tested this under AcqCreateItem=ordering. And verified that it did not change the items with AcqCreateItem=receiving. It works (I only struggled with booksellerid 952e that was overwritten later on). [We use AcqCreateItem=cataloging and have a different use on 952e. Probably, this field should not be in the marc 952 tag, as it is now.] No complaints from qa-tools. But I do have my doubts over this feature. First, AcqItemSetSubfieldsWhenReceived only works for AcqCreateItem=ordering. This should be noted more clearly in the pref description. What about setting an item value for AcqCreateItem=receiving or cataloging btw? Second, it looks like you want to update some status in the acquisition process and you implemented it in a perhaps somewhat unusual way that makes completely different applications possible. I am afraid that it could make code maintenance more difficult in the long run. Added a small followup for the split statement. Setting the status to Passed QA. I am not blocking this patch, but leave the final comment to RM.
Created attachment 18607 [details] [review] Bug 8307: Set a value for subfields when receiving If items are created when ordering, this patch allows to add a value for some items subfields. Test plan: Define status for items.notforloan (mapping 995$o in unimarc), for example 4:On order, 5:On treatment Set the Syspref AcqCreateItem on "ordering". ACQ framework : set default value = 4 for 995$o (in unimarc) Syspref AcqItemSetSubfieldsWhenReceived : set "o=5|b='foo bar'" When ordering the item, default status will be 4 ; when receiving the item, status will be changed from 4 to 5. The subfield b have to contain 'foo bar' Signed-off-by: Frederic Durand <frederic.durand@unilim.fr> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 18608 [details] [review] Bug 8307: QA Followup for finishreceive.pl Only split the expression a=b on the first = sign. Tested with the very unlikely z=x=1 :) Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Hi Marcel, I have been following this bug as it's an interesting feature I get asked about a lot. I am not sure I understand your concerns: >First, AcqItemSetSubfieldsWhenReceived only works for AcqCreateItem=ordering. >This should be noted more clearly in the pref description. >What about setting an item value for AcqCreateItem=receiving or cataloging btw? Not sure how it could work for those settings - it seems to me that in these cases we either have no item to change or no defined event to trigger the change?
(In reply to comment #22) > >First, AcqItemSetSubfieldsWhenReceived only works for AcqCreateItem=ordering. >This should be noted more clearly in the pref description. > >What about setting an item value for AcqCreateItem=receiving or cataloging btw? > > Not sure how it could work for those settings - it seems to me that in these > cases we either have no item to change or no defined event to trigger the > change? When you set it to receiving, you do have a new item. In that case it would function as a sort of default. So perhaps we should not do that? Trigger would be the same (confirm receive). In another way for cataloging, I opened another report once for default values for fund and itemtype (does not apply anymore). Just curious if we can get a broader application for this pref.
Hm, I think dealing with defaults is maybe better done in a different place as this is focused on changing existing values from one value to another. For the use case you gave maybe it would work to use default values in the frameworks?
(In reply to comment #24) > Hm, I think dealing with defaults is maybe better done in a different place > as this is focused on changing existing values from one value to another. > For the use case you gave maybe it would work to use default values in the > frameworks? Yes for the item values that probably would be enough. (Not for the fund and itemtype.) So it may be hard to widen the scope.
Pushed to master. Thanks, Jonathan! Being able to set item record values during receiving will be well received, but I must say that I am not a fan of how things have drifted: - It would be better to refer to item fields by their names, not how they happen to be mapped in a MARC framework. (By the way, I have an itch to stamp out the use of AddItemFromMarc and ModItemFromMarc, replacing it with direct calls to AddItem / ModItem, or their eventual DBIC equivalents. A helper routine to map a MARC field to an item should be used only when necessary -- during record import, primarily, and not item record editing). - It's not great that depending on what stage of the process you're dealing with, the configuration interface is either a syspref or the MARC frameworks.
I think the syspref description is a bit confusing: AcqItemSetSubfieldsWhenReceived Set subfields for item when items are created when receiving (e.g. o=5|a="foo bar") Shouldn't it be something like: Update subfields in items on receive when items are created when ordering (e.g. o=5|a="foo bar")
(In reply to Katrin Fischer from comment #27) > I think the syspref description is a bit confusing: > > AcqItemSetSubfieldsWhenReceived > Set subfields for item when items are created when receiving (e.g. > o=5|a="foo bar") > > Shouldn't it be something like: > Update subfields in items on receive when items are created when ordering > (e.g. o=5|a="foo bar") Yes, you are right. I proposed a patch on bug 11237.