(bug #2978) fix differents bugs in marc editor
This patch fix two bugs:
* tag duplication
If you try to duplicate an autority tag, the javascript call is kept, and the id is not modified, and fields are not emptied.
* openAuth() call
The id called on duplicated fields is not the great id.
And the different values sent to auth_finder.pl to pre-fetch datas from firstname, etc... send values from all same tags, and not from the selected tag.
(cherry picked from commit 40115eb110
)
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
parent
72563b0449
commit
04f8382d5b
2 changed files with 10 additions and 3 deletions
|
@ -396,7 +396,7 @@ sub create_input {
|
|||
maxlength=\"$max_length\"
|
||||
readonly=\"readonly\"
|
||||
\/><a href=\"#\" class=\"buttonDot\"
|
||||
onclick=\"openAuth('".$subfield_data{id}."','".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" title=\"Tag Editor\">...</a>
|
||||
onclick=\"openAuth(this.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" title=\"Tag Editor\">...</a>
|
||||
";
|
||||
}
|
||||
# it's a plugin field
|
||||
|
|
|
@ -162,10 +162,11 @@ function openAuth(tagsubfieldid,authtype) {
|
|||
var elementsubfcode=getSubfieldcode(element.name);
|
||||
var mainmainstring=element.value;
|
||||
var mainstring="";
|
||||
var inputs = document.getElementsByTagName("input");
|
||||
var inputs = element.parentNode.parentNode.getElementsByTagName("input");
|
||||
|
||||
for (var myindex =0; myindex<inputs.length;myindex++){
|
||||
if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){
|
||||
var subfieldcode=getSubfieldcode(inputs[myindex].name);
|
||||
var subfieldcode=getSubfieldcode(inputs[myindex].name);
|
||||
if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){
|
||||
mainstring=inputs[myindex].value+" "+mainstring;
|
||||
}
|
||||
|
@ -221,6 +222,12 @@ function CloneField(index) {
|
|||
var inputs = divs[i].getElementsByTagName('input');
|
||||
var id_input = "";
|
||||
|
||||
for( j = 0 ; j < inputs.length ; j++ ) {
|
||||
if(inputs[j].getAttribute("id") && inputs[j].getAttribute("id").match(/^tag_/) ){
|
||||
inputs[j].value = "";
|
||||
}
|
||||
}
|
||||
|
||||
inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
|
||||
inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key);
|
||||
var id_input;
|
||||
|
|
Loading…
Reference in a new issue