Main Koha release repository
https://koha-community.org
6d2e5f58f2
This patch series is a bugfix for the Marc modification templates tool. Bug description: If you want to do an action (delete/update/move/...) on a multivalued field and if a condition is defined on the same field, it is highly probable the resulted record will not be what you expect. For example: Deleting All (or the first) fields 650 if 245$a="Bad title" works with the current code. BUT if you want to delete All (or the first) fields 650 with a condition on 650$9=42, and if at least one field matches the condition : - if you have selected all, all fields 650 will be deleted, even the ones who do not match the condition. - if you have selected first, the first 650 field will be deleted, even if it does not match the condition. The expected behavior is to delete the fields matching the condition (and not all the 650 fields). What this patch does: This patch introduces 2 changes in the logic of Koha::SimpleMARC. The first change is a change of the prototypes for the 2 routines field_exists and field_equals. Now they return the "field number" of the matching fields. The second change is the type of the "n" parameter for all routines using it in Koha::SimpleMARC. Before this patch, the "n" parameter was a boolean in most cases. If 0, the action was done on all fields, if 1 on the first one only. Now it is possible to specify the "field numbers" (so the array of field numbers which is returned by field_exists or field_equals) for all routines which had the n parameter. Test plan for the patch series: Note: This test plan describes a specific example, feel free to create your own one. 0/ Define a marc modification template with the following action: Delete field 245 if 245$9 = 42 1/ choose and export a record with several 245 fields. For ex: 245 $a The art of computer programming $c Donald E. Knuth. $9 41 245 $a Bad title $c Bad author $9 42 2/ import it using the Stage MARC for import tool. 3/ verify the imported record does not contain any 245 field. 4/ apply all the patches from this bug report 5/ do again steps 2 and 3 6/ verify the imported record contains only one 245 field, the one with 245$9=41 7/ verify the unit tests passed: prove t/SimpleMARC.t prove t/db_dependent/MarcModificationTemplates.t Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> |
||
---|---|---|
acqui | ||
admin | ||
authorities | ||
basket | ||
C4 | ||
catalogue | ||
cataloguing | ||
circ | ||
course_reserves | ||
debian | ||
docs | ||
errors | ||
etc | ||
install_misc | ||
installer | ||
Koha | ||
koha-tmpl | ||
labels | ||
members | ||
misc | ||
offline_circ | ||
opac | ||
OpenILS | ||
patron_lists | ||
patroncards | ||
plugins | ||
reports | ||
reserve | ||
reviews | ||
rotating_collections | ||
selenium | ||
serials | ||
services | ||
skel | ||
sms | ||
suggestion | ||
svc | ||
t | ||
tags | ||
test | ||
tmp/modified_authorities | ||
tools | ||
virtualshelves | ||
xt | ||
.editorconfig | ||
.htaccess | ||
.mailmap | ||
about.pl | ||
changelanguage.pl | ||
edithelp.pl | ||
fix-perl-path.PL | ||
help.pl | ||
INSTALL | ||
install-CPAN.pl | ||
INSTALL.debian | ||
INSTALL.fedora7 | ||
INSTALL.opensuse | ||
INSTALL.ubuntu | ||
koha_perl_deps.pl | ||
kohaversion.pl | ||
LICENSE | ||
mainpage.pl | ||
Makefile.PL | ||
MANIFEST.SKIP | ||
README | ||
README.robots | ||
rewrite-config.PL |
Koha is a free software integrated library system. Koha is distributed under the GNU GPL version 3 or later. Please read the file LICENSE for more details. To install or upgrade Koha, please see the INSTALL file appropriate to your platform. Report bugs at http://bugs.koha-community.org/ Visit the Koha Project website at http://www.koha-community.org/