Bug 10648 - In records merge greatest field can not be added
authorFridolyn SOMERS <fridolyn.somers@biblibre.com>
Fri, 26 Jul 2013 15:02:01 +0000 (17:02 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 5 Aug 2014 23:17:17 +0000 (20:17 -0300)
commit7a5eac3a51b3dc5b344c91a729b282a191bf2c8e
treee9f0383ddb50ce4ffc647b3ea37a22ce0904393a
parentd3ece3601504e51878b00e49f9911e80b5337ac3
Bug 10648 - In records merge greatest field can not be added

When merging 2 records (/cgi-bin/koha/cataloguing/merge.pl), the destination record is build using the fields and subfields checked in source records.
When a field is checked, the javascript code searches in destination record a field with a greater tag number to insert new field before.
When the new field tag number is greater than all existing field tag numbers, the field is not added.

This patch corrects this by adding at end if no greater field tag number exists. Also adds a sort of fields by tag number because all mergo code is based on this.

Test plan :
- Add to a framework a repeatable field with the greater non existing tag number. For example 998.
- Edit 2 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.
=> The field is added at the end of destination record

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Works as described, no regressions.
koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js