Bugzilla – Attachment 22697 Details for
Bug 10648
In records merge greatest field can not be added
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10648 - In records merge greatest field can not be added
Bug-10648---In-records-merge-greatest-field-can-no.patch (text/plain), 3.62 KB, created by
Marcel de Rooy
on 2013-11-04 12:29:29 UTC
(
hide
)
Description:
Bug 10648 - In records merge greatest field can not be added
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-11-04 12:29:29 UTC
Size:
3.62 KB
patch
obsolete
>From a47c8719951e211ff22f29cc2c32ee5d9845845a Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Fri, 26 Jul 2013 17:02:01 +0200 >Subject: [PATCH] Bug 10648 - In records merge greatest field can not be added >Content-Type: text/plain; charset=utf-8 > >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:Mathieu Saby <mathieu.saby@univ-rennes2.fr> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Util/MARC.pm | 2 +- > koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js | 16 +++++++++++----- > 2 files changed, 12 insertions(+), 6 deletions(-) > >diff --git a/Koha/Util/MARC.pm b/Koha/Util/MARC.pm >index 5d026ee..5b31ee4 100644 >--- a/Koha/Util/MARC.pm >+++ b/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) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js b/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js >index 3686a0e..d47221e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js >+++ b/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 { >-- >1.7.7.6
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10648
:
19963
|
19965
|
21176
|
21177
|
21205
|
21838
|
22697
|
23877
|
29581
|
29843