@@ -, +, @@ - Add to a framework a repeatable field with the greates non existing tag number. For example 998. - Edit to records with this framework and add them a value in this tag. - Put those records is a list - Go to this list and check the two records - Click on "Merge selected" - Click on next - Go to second source record - Click on the greatest tag number. for example 998. --- Koha/Util/MARC.pm | 2 +- koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) --- a/Koha/Util/MARC.pm +++ a/Koha/Util/MARC.pm @@ -40,7 +40,7 @@ sub createMergeHash { my @array; my @fields = $record->fields(); - foreach my $field (@fields) { + foreach my $field ( sort { $a->tag() <=> $b->tag() } @fields) { my $fieldtag = $field->tag(); if ( $fieldtag < 10 ) { if ( !defined($tagslib) --- a/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js +++ a/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js @@ -79,8 +79,9 @@ function toggleField(pField) { // If not, we add the subfield to the first matching field var where = 0; $("#resultul li span.field").each(function() { - if (where == 0 && $(this).text() == field) { + if ($(this).text() == field) { where = this; + return false; // break each() } }); @@ -102,14 +103,19 @@ function toggleField(pField) { } else { // If we are a field var where = 0; - // Find where to add the field + // Find a greater field to add before $("#resultul li span.field").each(function() { - if (where == 0 && $(this).text() > field) { + if ($(this).text() > field) { where = this; + return false; // break each() } }); - - $(where).parent().before(clone); + if (where) { + $(where).parent().before(clone); + } else { + // No greater field, add to the end + $("#resultul").append(clone); + } } } } else { --