Bug 12743

Summary: Allow default values from the ACQ framework to be used when creating a record in acquisitions
Product: Koha Reporter: Gaetan Boisson <gaetan.boisson>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: abl, jonathan.druart, katrin.fischer, kyle, matthias.meusburger, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19289
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 12743: ACQ: default values for catalogue records
[SIGNED-OFF] Bug 12743: ACQ: default values for catalogue records
[PASSED QA] Bug 12743: ACQ: default values for catalogue records
Bug 12743: ACQ: default values for catalogue records
[SIGNED-OFF] Bug 12743: ACQ: default values for catalogue records
[PASSED QA] Bug 12743: ACQ: default values for catalogue records
Bug 12743: ACQ: default values for catalogue records

Description Gaetan Boisson 2014-08-11 12:39:23 UTC
At the moment, it is possible to create records in acquisitions, but the ACQ framework is only used for items created in this module.

We will work on a way to allow defining default values in the ACQ framework that will be carried over to the actual records. As is the case now, the record will stay attached to the default framework, the only difference is that if for instance you have set up a default biblio-level itemtype in the ACQ framework, the new record will have this value. Another useful scenario will be to position the correct value for opac-suppress for these records, so that they won't show in the OPAC before they are manually edited.
Comment 1 Jonathan Druart 2014-08-20 15:09:58 UTC Comment hidden (obsolete)
Comment 2 Gaetan Boisson 2014-08-22 12:46:42 UTC Comment hidden (obsolete)
Comment 3 Gaetan Boisson 2014-08-22 12:49:22 UTC
Tested, works!

Almost a bugfix as i always found it hard to explain that the ACQ framework only affected items.
Comment 4 Kyle M Hall 2014-08-22 14:25:37 UTC Comment hidden (obsolete)
Comment 5 Gaetan Boisson 2014-11-04 12:04:06 UTC
Bug found after more testing:

The fields of the form in acquisitions will create values in the marc record. If we have default values for the same fields in the ACQ framework, we will systematically have two marc tags created in the record. It is not a huge problem since very few fields are created by the form in acquisitions but would be better handled this way:

If the marc tag doesn't exist (ie wasn't created by the acquisitions form), create it with the subfield and its default values.
If the marc tag already exist, but the subfield doesn't, add the subfield with its default value to the existing tag
If both marc tag and subfield already exists, do nothing.

Of course one could argue that for repeatable fields, one should be able to chose where to create the subfield. But i don't see an easy way to do this, and since so few fields are concerned, i think we'd better just be careful when using this feature not to overlap too much with fields handled by the form.



Here's anexample (with french unimarc) of the current behaviour to make things clearer:

The document type field in the form will create a value in 099$t (bibliographic level itemtype.)
The ACQ framework is set to put a default value of 1 in 099$z.
Then the resulting record will look like this:

099 ## - Informations locales
  z 1
099 ## - Informations locales
  t [docupment type]

the field 099 being not repeatable, this is not valid, additionally, if one then manually edits the record, the two 099 show up in the interface, and if a default value is set for 099$t, the new record will look like this (two document types):

099 ## - Informations locales
  t [document type default value]
  z 1
099 ## - Informations locales
  t [docupment type]

If the ACQ framework has a default value for a subfield that is created by the acquisitions form, the marc tag will also be duplicated. Like this:
099 ## - Informations locales
  z 1 (value coming from the ACQ framework)
099 ## - Informations locales
  t (value coming from the ACQ framework)
099 ## - Informations locales
  t (value entered in the acquisitions form)
Comment 6 Jonathan Druart 2014-11-04 13:24:11 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2014-11-04 13:24:56 UTC
(In reply to Gaetan Boisson from comment #5)
> Bug found after more testing:

The last patch should take into account all cases you listed.

Back to needs signoff.
Comment 8 Gaetan Boisson 2014-11-05 09:10:31 UTC Comment hidden (obsolete)
Comment 9 Gaetan Boisson 2014-11-05 09:14:18 UTC
Tested the three cases:
- default value in a field/subfield that will not be created by the form in acquisitions (creation of a new field with the default value in the subfield)
- default value in a subfield for a field that will be created by the form, but whose subfield won't (creation of the subfield with the default value in the already existing field)
- default value in a subfield for which the form will create a value (nothing happens)

From what i understand, the from works depending on koha/marc mappings, so the title field for the form will create a value in whatever is mapped to biblio.title.
Comment 10 Katrin Fischer 2014-12-27 19:34:26 UTC
Hi Gaetan, please remember to obsolete the old patch when you sign of - thx!
Comment 11 Kyle M Hall 2015-01-02 15:39:50 UTC Comment hidden (obsolete)
Comment 12 Tomás Cohen Arazi 2015-05-07 13:46:40 UTC
Please rebase this one.
Comment 13 Jonathan Druart 2015-05-11 10:02:14 UTC
Created attachment 39032 [details] [review]
Bug 12743: ACQ: default values for catalogue records

At the moment, it is possible to create records in acquisitions, but the
ACQ framework is only used for items created in this module.

This patch allows to defined default values in the ACQ framework for
records created on the acquisition module.

Test plan:
1/ Make sure you have the ACQ framework created (otherwise create it
from the default framework).
2/ Define a default value for a field (for instance 099$z=1).
3/ Go in the acquisition module and create a new order from a new
record.
4/ Fill mandatory information and save.
5/ Go on the detail page of this record and verify the default value
exist.

Signed-off-by: Gaetan Boisson <gaetan.boisson@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Tomás Cohen Arazi 2015-05-26 13:08:17 UTC
Patch pushed to master.

Thanks Jonathan!

Note: I forgot to mark it "Pushed to master" but it is already on 3.20.