When adding or editing OAI-PMH mappings, using 0 as a value results in that mapping being deleted. 0 is a valid value, mappings should only be deleted when the value is empty.
I can confirm this behaviour. The reason is in file admin/oai_set_mappings.pl, line: if($marcfields[$i] and $marcsubfields[$i] and $marcvalues[$i]) I think it should be something like if($marcfields[$i] and $marcsubfields[$i] and ($marcvalues[$i] and $marcvalues ne ''))
Created attachment 14108 [details] [review] Bug 9201 OAI-PMH mapping value cannot be 0 Allow the value of a OAI set mapping to be 0 / empty. Delete the mapping if field or subfield are empty.
This patch is not touching the .tt file with description that says you need to empty one of these fields. I don't want to interfere with Bug 8906 that deletes this description anyway. Marking this bug as dependant on 8906 for that reason.
Created attachment 14271 [details] [review] Bug 9201 OAI-PMH mapping value cannot be 0 Allow the value of a OAI set mapping to be 0 / empty. Delete the mapping if field or subfield are empty. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Now it is possible to add a value == 0 or an empty string.
Created attachment 14940 [details] [review] Bug 9201 OAI-PMH mapping value cannot be 0 Allow the value of a OAI set mapping to be 0 / empty. Delete the mapping if field or subfield are empty. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Now it is possible to add a value == 0 or an empty string. Signed-off-by: Mason James <mtj@kohaaloha.com>
(In reply to comment #5) > Created attachment 14940 [details] [review] > Bug 9201 OAI-PMH mapping value cannot be 0 > > Allow the value of a OAI set mapping to be 0 / empty. Delete the mapping if > field or subfield are empty. > > Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> > Now it is possible to add a value == 0 or an empty string. > Signed-off-by: Mason James <mtj@kohaaloha.com> passing QA, works as expected...
Before I can push this, bug 8906 will have to be QAed. I will also need a detailed test plan so I can confirm that it actually works.
Before applying the patch: Go to Administration > OAI sets configuration Choose »Add a new set« setSpec: aaa setName: bbb Save Choose »Define mappings« for your new set. Enter »Field«: 100, »Subfield«: a, »Value«: 0 Click »Save« and see »Warning: no mappings defined for this set« Apply patch Enter field: 100, subfield: a, value: 0 Click »Save« and see that your mapping is saved
This patch has been pushed to master. I spoke with Mirko, and he clarified that the functionality does not depend on Bug 8906, so I am pushing this patch now.
Pushed to 3.10.x and 3.8.x will be in 3.10.3 and 3.8.10