@@ -, +, @@ - 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. --- cataloguing/merge.pl | 2 +- .../prog/en/modules/cataloguing/merge.tt | 23 +++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) --- a/cataloguing/merge.pl +++ a/cataloguing/merge.pl @@ -238,7 +238,7 @@ sub _createMarcHash { 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 ($tagslib->{$fieldtag}->{'@'}->{'tab'} >= 0) { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt @@ -101,8 +101,9 @@ $(document).ready(function(){ // 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() } }); @@ -127,14 +128,20 @@ $(document).ready(function(){ } else { // If we are a field var where = 0; - // Find where to add the field - $("#resultul li span.field").each(function() { - if (where == 0 && $(this).text() > field) { - where = this; - } - }); + // Find a greater field to add before + $("#resultul li span.field").each(function() { + if ($(this).text() > field) { + where = this; + return false; // break each() + } + }); + if (where) { + $(where).parent().before(clone); + } else { + // No greater field, add to the end + $("#resultul").append(clone); + } - $(where).parent().before(clone); } } } else { --